﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace EnvironmentEditor.DataModel
{
    public enum CellSide
    {
        North,
        East,
        South,
        West,
        Floor,
        Sky
    }

    public class MapCell
    {
        public short Floor;
        public short Sky;
        public short North;
        public short South;
        public short West;
        public short East;

        public bool IsEmpty
        {
            get
            {
                return
                    this.Floor == 0
                    && this.Sky == 0
                    && this.North == 0
                    && this.South == 0
                    && this.West == 0
                    && this.East == 0;
            }
        }

        public void SetWall(CellSide side, short wall)
        {
            switch (side)
            {
                case CellSide.North: this.North = wall; break;
                case CellSide.South: this.South = wall; break;
                case CellSide.West: this.West = wall; break;
                case CellSide.East: this.East = wall; break;
                case CellSide.Floor: this.Floor = wall; break;
                case CellSide.Sky: this.Sky = wall; break;
            }
        }

        public short GetWall(CellSide side)
        {
            switch (side)
            {
                case CellSide.North: return North; 
                case CellSide.South: return South;
                case CellSide.West: return West;
                case CellSide.East: return East;
                case CellSide.Floor: return Floor;
                case CellSide.Sky: return Sky;
            }

            return -1;
        }
    }
}
